package com.acme.task3;

public class Task3Arrays {

	private static double avg(int[] array){
	    if (array.length == 0) {
	        return Double.NaN;   // There could be an exception instead it
	    }
		double sum = 0;
		for (int i=0; i < array.length; ++i) {
			sum += array[i];
		}
		return sum / array.length;
	}
	
	public static void main(String[] args) {
		for (int i = 1; i <= 50; ++i) {
			System.out.println(i + 1);
		}
		for (int i = 1; i <= 50; ++i) {
			if (i % 3 == 0) {
				System.out.println(i+" is divisible by three");
			}
		}
		int[] nums = new int[50];
		for (int i = 0; i < 50; ++i) {
			nums[i] = i + 1;
		}
		System.out.println(avg(nums));
		System.out.println(avg(new int[0])); // NaN will be printed
	}

}
